#include "gtest/gtest.h"
// #include <mockcpp/mokc.h>
// #include <mockcpp/mockcpp.hpp>

#include <vector>
#include <iostream>
#include <sstream>
#include <sys/types.h>
#include <sys/wait.h>

#include "topoinfo_struct.h"
#include "log.h"
#include "checker_def.h"
#include "topo_meta.h"
#include "testcase_utils.h"
#include "alg_profiling.h"
#include "hccl_aiv.h"
#include "checker.h"

using namespace hccl;

class MiscTest : public testing::Test {
protected:
    static void SetUpTestCase()
    {
        std::cout << "MiscTest set up." << std::endl;
    }

    static void TearDownTestCase()
    {
        std::cout << "MiscTest tear down." << std::endl;
    }

    virtual void SetUp()
    {
        const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info();
        std::stringstream ss;
        ss << "analysis_result_" << std::string(test_info->test_case_name()) << "_" << std::string(test_info->name());
        checker::Checker::SetDumpFileName(ss.str());
    }

    virtual void TearDown()
    {
        checker::Checker::SetDumpFileName("analysis_result");
        // GlobalMockObject::verify();
        // 这边每个case执行完成需要清理所有的环境变量，如果有新增的环境变量，需要在这个函数中进行清理
        ClearHcclEnv();
    }
};

TEST_F(MiscTest, testcase_alg_profiling)
{
    RegisterAlgCallBack(nullptr, nullptr, -1);
    RegisterAlgCallBack(nullptr, nullptr, 1);
}

TEST_F(MiscTest, testcase_RegisterKernel)
{
    RegisterKernel(DevType::DEV_TYPE_910_93);
}

TEST_F(MiscTest, testcase_ClearAivSyncBufAndTag)
{
    s32 tmp;
    DeviceMem inAIVbuffer = DeviceMem::create(&tmp, 4);
    DeviceMem outAIVbuffer = DeviceMem::create(&tmp, 4);
    std::string identifier = "test";

    HcclResult ret;
    std::string tagKey = "tmp_test";
    AivResumeClearSyncBuf(inAIVbuffer, outAIVbuffer);
}